package cate.game.pvp.ladder.common;

import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Id;

@ToString
@NoteClass(value = "天梯赛对手快照", detail = "用于刷新时展示")
@Data
public class LadderOppoSnapshot {

    @Id
    @NoteField("排名")
    public int rank;

    @NoteField(value = "对手唯一ID", detail = "如果是玩家对应roleId，如果是机器人对应机器人唯一ID")
    public String id;

    @NoteField(value = "是否是机器人", detail = "true:是机器人;false:是玩家")
    public boolean robot;

    @NoteField("名字")
    public String name;

    @NoteField("所属游戏服ID")
    public int srvId;

    @NoteField("战力")
    public long power;


    @NoteField(value = "冒险形象ID")
    public int avatarTid;

    @NoteField(value = "上锁直至", detail = "比如该对手被挑战时，就会被锁定")
    public long lockUntil;

    @JsonIgnore
    @NoteField(value = "点赞数")
    public long admireNum;


    public void read(LadderOppoSnapshot src) {
        this.rank = src.rank;
        this.id = src.id;
        this.robot = src.robot;
        this.name = src.name;
        this.srvId = src.srvId;
        this.power = src.power;
        this.avatarTid = src.avatarTid;
        this.lockUntil = src.lockUntil;
    }

    public void randomForRobot(int rankNo) {
        this.rank = rankNo;
        this.id = "rbt"+rankNo;
        this.robot = true;
        this.name = "天梯" + rankNo + "层守卫";
        //this.srvId = -1;
        //this.level = (int)(30+Math.random() * 100);
    }
}
